{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "1cd3f7cd",
   "metadata": {},
   "outputs": [],
   "source": [
    "from sympy import *\n",
    "from sympy.abc import x,y,z,m,n,t,k\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "37c41f3c",
   "metadata": {},
   "source": [
    "## 数学一"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "67129113",
   "metadata": {},
   "outputs": [],
   "source": [
    "solve_set=solveset(Eq(x**2+4*k*x+2*k**2,4),x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "da5693d0",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[{4}, {0}]"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "answer=[]\n",
    "for item in solve_set:\n",
    "    answer.append(solveset(item+2,k))\n",
    "answer"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "ba736409",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[-0.900000000000000, 0.900000000000000]"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "solve(x**2-0.81)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "f07a327f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle -2.30277563773199$"
      ],
      "text/plain": [
       "-2.30277563773199"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "N(solve(x**2+x-3)[1])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "c27adeb6",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left\\{\\left( 3, \\  2\\right)\\right\\}$"
      ],
      "text/plain": [
       "{(3, 2)}"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "linsolve([3*x-2*y-5,x+y-5],[x,y])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "e0770b11",
   "metadata": {},
   "outputs": [],
   "source": [
    "a=x**2+x\n",
    "A=lambda n:a-(n-1)*(x+1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "6d9278f0",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle x^{2} + x$"
      ],
      "text/plain": [
       "x**2 + x"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "A(1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "3769b454",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle x^{2} - 1$"
      ],
      "text/plain": [
       "x**2 - 1"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "A(2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "2de20300",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle x^{2} - x - 2$"
      ],
      "text/plain": [
       "x**2 - x - 2"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "A(3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "efb8493b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle x^{2} - 2 x - 3$"
      ],
      "text/plain": [
       "x**2 - 2*x - 3"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "A(4)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "id": "27f37454",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle x^{2} - 2021 x - 2022$"
      ],
      "text/plain": [
       "x**2 - 2021*x - 2022"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "A(2023)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "id": "d6536d6d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[-1, n - 1]"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "solve(collect(expand(A(n)),x),x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "id": "0c5da1d4",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left\\{30, 45\\right\\}$"
      ],
      "text/plain": [
       "{30, 45}"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "solveset((1000-20*(x-25))*x-27000)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "id": "7f876c22",
   "metadata": {},
   "outputs": [],
   "source": [
    "def quadratic_equation_delt(eq,var):\n",
    "    # first we should check if eq is quadratic equation\n",
    "    # not complement yet\n",
    "    expr=simplify(eq.lhs-eq.rhs)\n",
    "    sums=expr.subs(x,1)\n",
    "    c=simplify(expr.subs(x,0))\n",
    "    b=simplify((sums-expr.subs(x,-1))/2)\n",
    "    a=sums-b-c\n",
    "    return simplify(b**2-4*a*c)\n",
    "        \n",
    "        "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "id": "0e9ab339",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle 5$"
      ],
      "text/plain": [
       "5"
      ]
     },
     "execution_count": 42,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "quadratic_equation_delt(Eq(x**2-3*x+1,0),x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "id": "917a7fb8",
   "metadata": {},
   "outputs": [],
   "source": [
    "answer=quadratic_equation_delt(Eq(k*x**2-(k+8)*x+8,0),x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "id": "5f34cbee",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left(k - 8\\right)^{2}$"
      ],
      "text/plain": [
       "(k - 8)**2"
      ]
     },
     "execution_count": 37,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "factor(answer)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "id": "80b5e97a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left\\{1, \\frac{8}{k}\\right\\}$"
      ],
      "text/plain": [
       "{1, 8/k}"
      ]
     },
     "execution_count": 38,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "solveset(Eq(k*x**2-(k+8)*x+8,0),x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "id": "104d8169",
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Help on class FiniteSet in module sympy.sets.sets:\n",
      "\n",
      "class FiniteSet(Set)\n",
      " |  FiniteSet(*args, **kwargs)\n",
      " |  \n",
      " |  Represents a finite set of discrete numbers.\n",
      " |  \n",
      " |  Examples\n",
      " |  ========\n",
      " |  \n",
      " |  >>> from sympy import FiniteSet\n",
      " |  >>> FiniteSet(1, 2, 3, 4)\n",
      " |  {1, 2, 3, 4}\n",
      " |  >>> 3 in FiniteSet(1, 2, 3, 4)\n",
      " |  True\n",
      " |  \n",
      " |  >>> members = [1, 2, 3, 4]\n",
      " |  >>> f = FiniteSet(*members)\n",
      " |  >>> f\n",
      " |  {1, 2, 3, 4}\n",
      " |  >>> f - FiniteSet(2)\n",
      " |  {1, 3, 4}\n",
      " |  >>> f + FiniteSet(2, 5)\n",
      " |  {1, 2, 3, 4, 5}\n",
      " |  \n",
      " |  References\n",
      " |  ==========\n",
      " |  \n",
      " |  .. [1] https://en.wikipedia.org/wiki/Finite_set\n",
      " |  \n",
      " |  Method resolution order:\n",
      " |      FiniteSet\n",
      " |      Set\n",
      " |      sympy.core.basic.Basic\n",
      " |      sympy.printing.defaults.Printable\n",
      " |      sympy.core.evalf.EvalfMixin\n",
      " |      builtins.object\n",
      " |  \n",
      " |  Methods defined here:\n",
      " |  \n",
      " |  __eq__(self, other)\n",
      " |      Return a boolean indicating whether a == b on the basis of\n",
      " |      their symbolic trees.\n",
      " |      \n",
      " |      This is the same as a.compare(b) == 0 but faster.\n",
      " |      \n",
      " |      Notes\n",
      " |      =====\n",
      " |      \n",
      " |      If a class that overrides __eq__() needs to retain the\n",
      " |      implementation of __hash__() from a parent class, the\n",
      " |      interpreter must be told this explicitly by setting\n",
      " |      __hash__ : Callable[[object], int] = <ParentClass>.__hash__.\n",
      " |      Otherwise the inheritance of __hash__() will be blocked,\n",
      " |      just as if __hash__ had been explicitly set to None.\n",
      " |      \n",
      " |      References\n",
      " |      ==========\n",
      " |      \n",
      " |      from http://docs.python.org/dev/reference/datamodel.html#object.__hash__\n",
      " |  \n",
      " |  __ge__(self, other)\n",
      " |      Return self>=value.\n",
      " |  \n",
      " |  __gt__(self, other)\n",
      " |      Return self>value.\n",
      " |  \n",
      " |  __hash__(self) -> int\n",
      " |      Return hash(self).\n",
      " |  \n",
      " |  __iter__(self)\n",
      " |  \n",
      " |  __le__(self, other)\n",
      " |      Return self<=value.\n",
      " |  \n",
      " |  __len__(self)\n",
      " |  \n",
      " |  __lt__(self, other)\n",
      " |      Return self<value.\n",
      " |  \n",
      " |  as_relational(self, symbol)\n",
      " |      Rewrite a FiniteSet in terms of equalities and logic operators.\n",
      " |  \n",
      " |  compare(self, other)\n",
      " |      Return -1, 0, 1 if the object is smaller, equal, or greater than other.\n",
      " |      \n",
      " |      Not in the mathematical sense. If the object is of a different type\n",
      " |      from the \"other\" then their classes are ordered according to\n",
      " |      the sorted_classes list.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy.abc import x, y\n",
      " |      >>> x.compare(y)\n",
      " |      -1\n",
      " |      >>> x.compare(x)\n",
      " |      0\n",
      " |      >>> y.compare(x)\n",
      " |      1\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Static methods defined here:\n",
      " |  \n",
      " |  __new__(cls, *args, **kwargs)\n",
      " |      Create and return a new object.  See help(type) for accurate signature.\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Readonly properties defined here:\n",
      " |  \n",
      " |  __sympy__\n",
      " |  \n",
      " |  measure\n",
      " |      The (Lebesgue) measure of ``self``.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Interval, Union\n",
      " |      >>> Interval(0, 1).measure\n",
      " |      1\n",
      " |      >>> Union(Interval(0, 1), Interval(2, 3)).measure\n",
      " |      2\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Data and other attributes defined here:\n",
      " |  \n",
      " |  __annotations__ = {'__hash__': typing.Callable[[sympy.core.basic.Basic...\n",
      " |  \n",
      " |  default_assumptions = {}\n",
      " |  \n",
      " |  is_FiniteSet = True\n",
      " |  \n",
      " |  is_empty = False\n",
      " |  \n",
      " |  is_finite_set = True\n",
      " |  \n",
      " |  is_iterable = True\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Methods inherited from Set:\n",
      " |  \n",
      " |  __add__(self, other)\n",
      " |  \n",
      " |  __and__(self, other)\n",
      " |  \n",
      " |  __contains__(self, other)\n",
      " |  \n",
      " |  __mul__(self, other)\n",
      " |  \n",
      " |  __or__(self, other)\n",
      " |  \n",
      " |  __pow__(self, exp)\n",
      " |  \n",
      " |  __sub__(self, other)\n",
      " |  \n",
      " |  __xor__(self, other)\n",
      " |  \n",
      " |  complement(self, universe)\n",
      " |      The complement of 'self' w.r.t the given universe.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Interval, S\n",
      " |      >>> Interval(0, 1).complement(S.Reals)\n",
      " |      Union(Interval.open(-oo, 0), Interval.open(1, oo))\n",
      " |      \n",
      " |      >>> Interval(0, 1).complement(S.UniversalSet)\n",
      " |      Complement(UniversalSet, Interval(0, 1))\n",
      " |  \n",
      " |  contains(self, other)\n",
      " |      Returns a SymPy value indicating whether ``other`` is contained\n",
      " |      in ``self``: ``true`` if it is, ``false`` if it isn't, else\n",
      " |      an unevaluated ``Contains`` expression (or, as in the case of\n",
      " |      ConditionSet and a union of FiniteSet/Intervals, an expression\n",
      " |      indicating the conditions for containment).\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Interval, S\n",
      " |      >>> from sympy.abc import x\n",
      " |      \n",
      " |      >>> Interval(0, 1).contains(0.5)\n",
      " |      True\n",
      " |      \n",
      " |      As a shortcut it is possible to use the ``in`` operator, but that\n",
      " |      will raise an error unless an affirmative true or false is not\n",
      " |      obtained.\n",
      " |      \n",
      " |      >>> Interval(0, 1).contains(x)\n",
      " |      (0 <= x) & (x <= 1)\n",
      " |      >>> x in Interval(0, 1)\n",
      " |      Traceback (most recent call last):\n",
      " |      ...\n",
      " |      TypeError: did not evaluate to a bool: None\n",
      " |      \n",
      " |      The result of 'in' is a bool, not a SymPy value\n",
      " |      \n",
      " |      >>> 1 in Interval(0, 2)\n",
      " |      True\n",
      " |      >>> _ is S.true\n",
      " |      False\n",
      " |  \n",
      " |  intersect(self, other)\n",
      " |      Returns the intersection of 'self' and 'other'.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Interval\n",
      " |      \n",
      " |      >>> Interval(1, 3).intersect(Interval(1, 2))\n",
      " |      Interval(1, 2)\n",
      " |      \n",
      " |      >>> from sympy import imageset, Lambda, symbols, S\n",
      " |      >>> n, m = symbols('n m')\n",
      " |      >>> a = imageset(Lambda(n, 2*n), S.Integers)\n",
      " |      >>> a.intersect(imageset(Lambda(m, 2*m + 1), S.Integers))\n",
      " |      EmptySet\n",
      " |  \n",
      " |  intersection(self, other)\n",
      " |      Alias for :meth:`intersect()`\n",
      " |  \n",
      " |  is_disjoint(self, other)\n",
      " |      Returns True if ``self`` and ``other`` are disjoint.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Interval\n",
      " |      >>> Interval(0, 2).is_disjoint(Interval(1, 2))\n",
      " |      False\n",
      " |      >>> Interval(0, 2).is_disjoint(Interval(3, 4))\n",
      " |      True\n",
      " |      \n",
      " |      References\n",
      " |      ==========\n",
      " |      \n",
      " |      .. [1] https://en.wikipedia.org/wiki/Disjoint_sets\n",
      " |  \n",
      " |  is_proper_subset(self, other)\n",
      " |      Returns True if ``self`` is a proper subset of ``other``.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Interval\n",
      " |      >>> Interval(0, 0.5).is_proper_subset(Interval(0, 1))\n",
      " |      True\n",
      " |      >>> Interval(0, 1).is_proper_subset(Interval(0, 1))\n",
      " |      False\n",
      " |  \n",
      " |  is_proper_superset(self, other)\n",
      " |      Returns True if ``self`` is a proper superset of ``other``.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Interval\n",
      " |      >>> Interval(0, 1).is_proper_superset(Interval(0, 0.5))\n",
      " |      True\n",
      " |      >>> Interval(0, 1).is_proper_superset(Interval(0, 1))\n",
      " |      False\n",
      " |  \n",
      " |  is_subset(self, other)\n",
      " |      Returns True if ``self`` is a subset of ``other``.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Interval\n",
      " |      >>> Interval(0, 0.5).is_subset(Interval(0, 1))\n",
      " |      True\n",
      " |      >>> Interval(0, 1).is_subset(Interval(0, 1, left_open=True))\n",
      " |      False\n",
      " |  \n",
      " |  is_superset(self, other)\n",
      " |      Returns True if ``self`` is a superset of ``other``.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Interval\n",
      " |      >>> Interval(0, 0.5).is_superset(Interval(0, 1))\n",
      " |      False\n",
      " |      >>> Interval(0, 1).is_superset(Interval(0, 1, left_open=True))\n",
      " |      True\n",
      " |  \n",
      " |  isdisjoint(self, other)\n",
      " |      Alias for :meth:`is_disjoint()`\n",
      " |  \n",
      " |  issubset(self, other)\n",
      " |      Alias for :meth:`is_subset()`\n",
      " |  \n",
      " |  issuperset(self, other)\n",
      " |      Alias for :meth:`is_superset()`\n",
      " |  \n",
      " |  powerset(self)\n",
      " |      Find the Power set of ``self``.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import EmptySet, FiniteSet, Interval\n",
      " |      \n",
      " |      A power set of an empty set:\n",
      " |      \n",
      " |      >>> A = EmptySet\n",
      " |      >>> A.powerset()\n",
      " |      {EmptySet}\n",
      " |      \n",
      " |      A power set of a finite set:\n",
      " |      \n",
      " |      >>> A = FiniteSet(1, 2)\n",
      " |      >>> a, b, c = FiniteSet(1), FiniteSet(2), FiniteSet(1, 2)\n",
      " |      >>> A.powerset() == FiniteSet(a, b, c, EmptySet)\n",
      " |      True\n",
      " |      \n",
      " |      A power set of an interval:\n",
      " |      \n",
      " |      >>> Interval(1, 2).powerset()\n",
      " |      PowerSet(Interval(1, 2))\n",
      " |      \n",
      " |      References\n",
      " |      ==========\n",
      " |      \n",
      " |      .. [1] https://en.wikipedia.org/wiki/Power_set\n",
      " |  \n",
      " |  symmetric_difference(self, other)\n",
      " |      Returns symmetric difference of ``self`` and ``other``.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Interval, S\n",
      " |      >>> Interval(1, 3).symmetric_difference(S.Reals)\n",
      " |      Union(Interval.open(-oo, 1), Interval.open(3, oo))\n",
      " |      >>> Interval(1, 10).symmetric_difference(S.Reals)\n",
      " |      Union(Interval.open(-oo, 1), Interval.open(10, oo))\n",
      " |      \n",
      " |      >>> from sympy import S, EmptySet\n",
      " |      >>> S.Reals.symmetric_difference(EmptySet)\n",
      " |      Reals\n",
      " |      \n",
      " |      References\n",
      " |      ==========\n",
      " |      .. [1] https://en.wikipedia.org/wiki/Symmetric_difference\n",
      " |  \n",
      " |  union(self, other)\n",
      " |      Returns the union of ``self`` and ``other``.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      As a shortcut it is possible to use the ``+`` operator:\n",
      " |      \n",
      " |      >>> from sympy import Interval, FiniteSet\n",
      " |      >>> Interval(0, 1).union(Interval(2, 3))\n",
      " |      Union(Interval(0, 1), Interval(2, 3))\n",
      " |      >>> Interval(0, 1) + Interval(2, 3)\n",
      " |      Union(Interval(0, 1), Interval(2, 3))\n",
      " |      >>> Interval(1, 2, True, True) + FiniteSet(2, 3)\n",
      " |      Union({3}, Interval.Lopen(1, 2))\n",
      " |      \n",
      " |      Similarly it is possible to use the ``-`` operator for set differences:\n",
      " |      \n",
      " |      >>> Interval(0, 2) - Interval(0, 1)\n",
      " |      Interval.Lopen(1, 2)\n",
      " |      >>> Interval(1, 3) - FiniteSet(2)\n",
      " |      Union(Interval.Ropen(1, 2), Interval.Lopen(2, 3))\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Readonly properties inherited from Set:\n",
      " |  \n",
      " |  boundary\n",
      " |      The boundary or frontier of a set.\n",
      " |      \n",
      " |      Explanation\n",
      " |      ===========\n",
      " |      \n",
      " |      A point x is on the boundary of a set S if\n",
      " |      \n",
      " |      1.  x is in the closure of S.\n",
      " |          I.e. Every neighborhood of x contains a point in S.\n",
      " |      2.  x is not in the interior of S.\n",
      " |          I.e. There does not exist an open set centered on x contained\n",
      " |          entirely within S.\n",
      " |      \n",
      " |      There are the points on the outer rim of S.  If S is open then these\n",
      " |      points need not actually be contained within S.\n",
      " |      \n",
      " |      For example, the boundary of an interval is its start and end points.\n",
      " |      This is true regardless of whether or not the interval is open.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Interval\n",
      " |      >>> Interval(0, 1).boundary\n",
      " |      {0, 1}\n",
      " |      >>> Interval(0, 1, True, False).boundary\n",
      " |      {0, 1}\n",
      " |  \n",
      " |  closure\n",
      " |      Property method which returns the closure of a set.\n",
      " |      The closure is defined as the union of the set itself and its\n",
      " |      boundary.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      >>> from sympy import S, Interval\n",
      " |      >>> S.Reals.closure\n",
      " |      Reals\n",
      " |      >>> Interval(0, 1).closure\n",
      " |      Interval(0, 1)\n",
      " |  \n",
      " |  inf\n",
      " |      The infimum of ``self``.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Interval, Union\n",
      " |      >>> Interval(0, 1).inf\n",
      " |      0\n",
      " |      >>> Union(Interval(0, 1), Interval(2, 3)).inf\n",
      " |      0\n",
      " |  \n",
      " |  interior\n",
      " |      Property method which returns the interior of a set.\n",
      " |      The interior of a set S consists all points of S that do not\n",
      " |      belong to the boundary of S.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      >>> from sympy import Interval\n",
      " |      >>> Interval(0, 1).interior\n",
      " |      Interval.open(0, 1)\n",
      " |      >>> Interval(0, 1).boundary.interior\n",
      " |      EmptySet\n",
      " |  \n",
      " |  is_EmptySet\n",
      " |  \n",
      " |  is_closed\n",
      " |      A property method to check whether a set is closed.\n",
      " |      \n",
      " |      Explanation\n",
      " |      ===========\n",
      " |      \n",
      " |      A set is closed if its complement is an open set. The closedness of a\n",
      " |      subset of the reals is determined with respect to R and its standard\n",
      " |      topology.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      >>> from sympy import Interval\n",
      " |      >>> Interval(0, 1).is_closed\n",
      " |      True\n",
      " |  \n",
      " |  is_open\n",
      " |      Property method to check whether a set is open.\n",
      " |      \n",
      " |      Explanation\n",
      " |      ===========\n",
      " |      \n",
      " |      A set is open if and only if it has an empty intersection with its\n",
      " |      boundary. In particular, a subset A of the reals is open if and only\n",
      " |      if each one of its points is contained in an open interval that is a\n",
      " |      subset of A.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      >>> from sympy import S\n",
      " |      >>> S.Reals.is_open\n",
      " |      True\n",
      " |      >>> S.Rationals.is_open\n",
      " |      False\n",
      " |  \n",
      " |  sup\n",
      " |      The supremum of ``self``.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Interval, Union\n",
      " |      >>> Interval(0, 1).sup\n",
      " |      1\n",
      " |      >>> Union(Interval(0, 1), Interval(2, 3)).sup\n",
      " |      3\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Data descriptors inherited from Set:\n",
      " |  \n",
      " |  __dict__\n",
      " |      dictionary for instance variables (if defined)\n",
      " |  \n",
      " |  __weakref__\n",
      " |      list of weak references to the object (if defined)\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Data and other attributes inherited from Set:\n",
      " |  \n",
      " |  is_Complement = None\n",
      " |  \n",
      " |  is_ComplexRegion = False\n",
      " |  \n",
      " |  is_Intersection = None\n",
      " |  \n",
      " |  is_Interval = False\n",
      " |  \n",
      " |  is_ProductSet = False\n",
      " |  \n",
      " |  is_Union = False\n",
      " |  \n",
      " |  is_UniversalSet = None\n",
      " |  \n",
      " |  is_interval = False\n",
      " |  \n",
      " |  is_number = False\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Methods inherited from sympy.core.basic.Basic:\n",
      " |  \n",
      " |  __getnewargs__(self)\n",
      " |  \n",
      " |  __getstate__(self)\n",
      " |  \n",
      " |  __ne__(self, other)\n",
      " |      ``a != b``  -> Compare two symbolic trees and see whether they are different\n",
      " |      \n",
      " |      this is the same as:\n",
      " |      \n",
      " |      ``a.compare(b) != 0``\n",
      " |      \n",
      " |      but faster\n",
      " |  \n",
      " |  __reduce_ex__(self, protocol)\n",
      " |      Helper for pickle.\n",
      " |  \n",
      " |  __setstate__(self, state)\n",
      " |  \n",
      " |  as_content_primitive(self, radical=False, clear=True)\n",
      " |      A stub to allow Basic args (like Tuple) to be skipped when computing\n",
      " |      the content and primitive components of an expression.\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      \n",
      " |      sympy.core.expr.Expr.as_content_primitive\n",
      " |  \n",
      " |  as_dummy(self)\n",
      " |      Return the expression with any objects having structurally\n",
      " |      bound symbols replaced with unique, canonical symbols within\n",
      " |      the object in which they appear and having only the default\n",
      " |      assumption for commutativity being True. When applied to a\n",
      " |      symbol a new symbol having only the same commutativity will be\n",
      " |      returned.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Integral, Symbol\n",
      " |      >>> from sympy.abc import x\n",
      " |      >>> r = Symbol('r', real=True)\n",
      " |      >>> Integral(r, (r, x)).as_dummy()\n",
      " |      Integral(_0, (_0, x))\n",
      " |      >>> _.variables[0].is_real is None\n",
      " |      True\n",
      " |      >>> r.as_dummy()\n",
      " |      _r\n",
      " |      \n",
      " |      Notes\n",
      " |      =====\n",
      " |      \n",
      " |      Any object that has structurally bound variables should have\n",
      " |      a property, `bound_symbols` that returns those symbols\n",
      " |      appearing in the object.\n",
      " |  \n",
      " |  atoms(self, *types)\n",
      " |      Returns the atoms that form the current object.\n",
      " |      \n",
      " |      By default, only objects that are truly atomic and cannot\n",
      " |      be divided into smaller pieces are returned: symbols, numbers,\n",
      " |      and number symbols like I and pi. It is possible to request\n",
      " |      atoms of any type, however, as demonstrated below.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import I, pi, sin\n",
      " |      >>> from sympy.abc import x, y\n",
      " |      >>> (1 + x + 2*sin(y + I*pi)).atoms()\n",
      " |      {1, 2, I, pi, x, y}\n",
      " |      \n",
      " |      If one or more types are given, the results will contain only\n",
      " |      those types of atoms.\n",
      " |      \n",
      " |      >>> from sympy import Number, NumberSymbol, Symbol\n",
      " |      >>> (1 + x + 2*sin(y + I*pi)).atoms(Symbol)\n",
      " |      {x, y}\n",
      " |      \n",
      " |      >>> (1 + x + 2*sin(y + I*pi)).atoms(Number)\n",
      " |      {1, 2}\n",
      " |      \n",
      " |      >>> (1 + x + 2*sin(y + I*pi)).atoms(Number, NumberSymbol)\n",
      " |      {1, 2, pi}\n",
      " |      \n",
      " |      >>> (1 + x + 2*sin(y + I*pi)).atoms(Number, NumberSymbol, I)\n",
      " |      {1, 2, I, pi}\n",
      " |      \n",
      " |      Note that I (imaginary unit) and zoo (complex infinity) are special\n",
      " |      types of number symbols and are not part of the NumberSymbol class.\n",
      " |      \n",
      " |      The type can be given implicitly, too:\n",
      " |      \n",
      " |      >>> (1 + x + 2*sin(y + I*pi)).atoms(x) # x is a Symbol\n",
      " |      {x, y}\n",
      " |      \n",
      " |      Be careful to check your assumptions when using the implicit option\n",
      " |      since ``S(1).is_Integer = True`` but ``type(S(1))`` is ``One``, a special type\n",
      " |      of SymPy atom, while ``type(S(2))`` is type ``Integer`` and will find all\n",
      " |      integers in an expression:\n",
      " |      \n",
      " |      >>> from sympy import S\n",
      " |      >>> (1 + x + 2*sin(y + I*pi)).atoms(S(1))\n",
      " |      {1}\n",
      " |      \n",
      " |      >>> (1 + x + 2*sin(y + I*pi)).atoms(S(2))\n",
      " |      {1, 2}\n",
      " |      \n",
      " |      Finally, arguments to atoms() can select more than atomic atoms: any\n",
      " |      SymPy type (loaded in core/__init__.py) can be listed as an argument\n",
      " |      and those types of \"atoms\" as found in scanning the arguments of the\n",
      " |      expression recursively:\n",
      " |      \n",
      " |      >>> from sympy import Function, Mul\n",
      " |      >>> from sympy.core.function import AppliedUndef\n",
      " |      >>> f = Function('f')\n",
      " |      >>> (1 + f(x) + 2*sin(y + I*pi)).atoms(Function)\n",
      " |      {f(x), sin(y + I*pi)}\n",
      " |      >>> (1 + f(x) + 2*sin(y + I*pi)).atoms(AppliedUndef)\n",
      " |      {f(x)}\n",
      " |      \n",
      " |      >>> (1 + x + 2*sin(y + I*pi)).atoms(Mul)\n",
      " |      {I*pi, 2*sin(y + I*pi)}\n",
      " |  \n",
      " |  copy(self)\n",
      " |  \n",
      " |  could_extract_minus_sign(self)\n",
      " |  \n",
      " |  count(self, query)\n",
      " |      Count the number of matching subexpressions.\n",
      " |  \n",
      " |  count_ops(self, visual=None)\n",
      " |      wrapper for count_ops that returns the operation count.\n",
      " |  \n",
      " |  doit(self, **hints)\n",
      " |      Evaluate objects that are not evaluated by default like limits,\n",
      " |      integrals, sums and products. All objects of this kind will be\n",
      " |      evaluated recursively, unless some species were excluded via 'hints'\n",
      " |      or unless the 'deep' hint was set to 'False'.\n",
      " |      \n",
      " |      >>> from sympy import Integral\n",
      " |      >>> from sympy.abc import x\n",
      " |      \n",
      " |      >>> 2*Integral(x, x)\n",
      " |      2*Integral(x, x)\n",
      " |      \n",
      " |      >>> (2*Integral(x, x)).doit()\n",
      " |      x**2\n",
      " |      \n",
      " |      >>> (2*Integral(x, x)).doit(deep=False)\n",
      " |      2*Integral(x, x)\n",
      " |  \n",
      " |  dummy_eq(self, other, symbol=None)\n",
      " |      Compare two expressions and handle dummy symbols.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Dummy\n",
      " |      >>> from sympy.abc import x, y\n",
      " |      \n",
      " |      >>> u = Dummy('u')\n",
      " |      \n",
      " |      >>> (u**2 + 1).dummy_eq(x**2 + 1)\n",
      " |      True\n",
      " |      >>> (u**2 + 1) == (x**2 + 1)\n",
      " |      False\n",
      " |      \n",
      " |      >>> (u**2 + y).dummy_eq(x**2 + y, x)\n",
      " |      True\n",
      " |      >>> (u**2 + y).dummy_eq(x**2 + y, y)\n",
      " |      False\n",
      " |  \n",
      " |  find(self, query, group=False)\n",
      " |      Find all subexpressions matching a query.\n",
      " |  \n",
      " |  has(self, *patterns)\n",
      " |      Test whether any subexpression matches any of the patterns.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import sin\n",
      " |      >>> from sympy.abc import x, y, z\n",
      " |      >>> (x**2 + sin(x*y)).has(z)\n",
      " |      False\n",
      " |      >>> (x**2 + sin(x*y)).has(x, y, z)\n",
      " |      True\n",
      " |      >>> x.has(x)\n",
      " |      True\n",
      " |      \n",
      " |      Note ``has`` is a structural algorithm with no knowledge of\n",
      " |      mathematics. Consider the following half-open interval:\n",
      " |      \n",
      " |      >>> from sympy import Interval\n",
      " |      >>> i = Interval.Lopen(0, 5); i\n",
      " |      Interval.Lopen(0, 5)\n",
      " |      >>> i.args\n",
      " |      (0, 5, True, False)\n",
      " |      >>> i.has(4)  # there is no \"4\" in the arguments\n",
      " |      False\n",
      " |      >>> i.has(0)  # there *is* a \"0\" in the arguments\n",
      " |      True\n",
      " |      \n",
      " |      Instead, use ``contains`` to determine whether a number is in the\n",
      " |      interval or not:\n",
      " |      \n",
      " |      >>> i.contains(4)\n",
      " |      True\n",
      " |      >>> i.contains(0)\n",
      " |      False\n",
      " |      \n",
      " |      \n",
      " |      Note that ``expr.has(*patterns)`` is exactly equivalent to\n",
      " |      ``any(expr.has(p) for p in patterns)``. In particular, ``False`` is\n",
      " |      returned when the list of patterns is empty.\n",
      " |      \n",
      " |      >>> x.has()\n",
      " |      False\n",
      " |  \n",
      " |  has_free(self, *patterns)\n",
      " |      return True if self has object(s) ``x`` as a free expression\n",
      " |      else False.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Integral, Function\n",
      " |      >>> from sympy.abc import x, y\n",
      " |      >>> f = Function('f')\n",
      " |      >>> g = Function('g')\n",
      " |      >>> expr = Integral(f(x), (f(x), 1, g(y)))\n",
      " |      >>> expr.free_symbols\n",
      " |      {y}\n",
      " |      >>> expr.has_free(g(y))\n",
      " |      True\n",
      " |      >>> expr.has_free(*(x, f(x)))\n",
      " |      False\n",
      " |      \n",
      " |      This works for subexpressions and types, too:\n",
      " |      \n",
      " |      >>> expr.has_free(g)\n",
      " |      True\n",
      " |      >>> (x + y + 1).has_free(y + 1)\n",
      " |      True\n",
      " |  \n",
      " |  is_hypergeometric(self, k)\n",
      " |  \n",
      " |  match(self, pattern, old=False)\n",
      " |      Pattern matching.\n",
      " |      \n",
      " |      Wild symbols match all.\n",
      " |      \n",
      " |      Return ``None`` when expression (self) does not match\n",
      " |      with pattern. Otherwise return a dictionary such that::\n",
      " |      \n",
      " |        pattern.xreplace(self.match(pattern)) == self\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Wild, Sum\n",
      " |      >>> from sympy.abc import x, y\n",
      " |      >>> p = Wild(\"p\")\n",
      " |      >>> q = Wild(\"q\")\n",
      " |      >>> r = Wild(\"r\")\n",
      " |      >>> e = (x+y)**(x+y)\n",
      " |      >>> e.match(p**p)\n",
      " |      {p_: x + y}\n",
      " |      >>> e.match(p**q)\n",
      " |      {p_: x + y, q_: x + y}\n",
      " |      >>> e = (2*x)**2\n",
      " |      >>> e.match(p*q**r)\n",
      " |      {p_: 4, q_: x, r_: 2}\n",
      " |      >>> (p*q**r).xreplace(e.match(p*q**r))\n",
      " |      4*x**2\n",
      " |      \n",
      " |      Structurally bound symbols are ignored during matching:\n",
      " |      \n",
      " |      >>> Sum(x, (x, 1, 2)).match(Sum(y, (y, 1, p)))\n",
      " |      {p_: 2}\n",
      " |      \n",
      " |      But they can be identified if desired:\n",
      " |      \n",
      " |      >>> Sum(x, (x, 1, 2)).match(Sum(q, (q, 1, p)))\n",
      " |      {p_: 2, q_: x}\n",
      " |      \n",
      " |      The ``old`` flag will give the old-style pattern matching where\n",
      " |      expressions and patterns are essentially solved to give the\n",
      " |      match. Both of the following give None unless ``old=True``:\n",
      " |      \n",
      " |      >>> (x - 2).match(p - x, old=True)\n",
      " |      {p_: 2*x - 2}\n",
      " |      >>> (2/x).match(p*x, old=True)\n",
      " |      {p_: 2/x**2}\n",
      " |  \n",
      " |  matches(self, expr, repl_dict=None, old=False)\n",
      " |      Helper method for match() that looks for a match between Wild symbols\n",
      " |      in self and expressions in expr.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import symbols, Wild, Basic\n",
      " |      >>> a, b, c = symbols('a b c')\n",
      " |      >>> x = Wild('x')\n",
      " |      >>> Basic(a + x, x).matches(Basic(a + b, c)) is None\n",
      " |      True\n",
      " |      >>> Basic(a + x, x).matches(Basic(a + b + c, b + c))\n",
      " |      {x_: b + c}\n",
      " |  \n",
      " |  rcall(self, *args)\n",
      " |      Apply on the argument recursively through the expression tree.\n",
      " |      \n",
      " |      This method is used to simulate a common abuse of notation for\n",
      " |      operators. For instance, in SymPy the following will not work:\n",
      " |      \n",
      " |      ``(x+Lambda(y, 2*y))(z) == x+2*z``,\n",
      " |      \n",
      " |      however, you can use:\n",
      " |      \n",
      " |      >>> from sympy import Lambda\n",
      " |      >>> from sympy.abc import x, y, z\n",
      " |      >>> (x + Lambda(y, 2*y)).rcall(z)\n",
      " |      x + 2*z\n",
      " |  \n",
      " |  refine(self, assumption=True)\n",
      " |      See the refine function in sympy.assumptions\n",
      " |  \n",
      " |  replace(self, query, value, map=False, simultaneous=True, exact=None)\n",
      " |      Replace matching subexpressions of ``self`` with ``value``.\n",
      " |      \n",
      " |      If ``map = True`` then also return the mapping {old: new} where ``old``\n",
      " |      was a sub-expression found with query and ``new`` is the replacement\n",
      " |      value for it. If the expression itself doesn't match the query, then\n",
      " |      the returned value will be ``self.xreplace(map)`` otherwise it should\n",
      " |      be ``self.subs(ordered(map.items()))``.\n",
      " |      \n",
      " |      Traverses an expression tree and performs replacement of matching\n",
      " |      subexpressions from the bottom to the top of the tree. The default\n",
      " |      approach is to do the replacement in a simultaneous fashion so\n",
      " |      changes made are targeted only once. If this is not desired or causes\n",
      " |      problems, ``simultaneous`` can be set to False.\n",
      " |      \n",
      " |      In addition, if an expression containing more than one Wild symbol\n",
      " |      is being used to match subexpressions and the ``exact`` flag is None\n",
      " |      it will be set to True so the match will only succeed if all non-zero\n",
      " |      values are received for each Wild that appears in the match pattern.\n",
      " |      Setting this to False accepts a match of 0; while setting it True\n",
      " |      accepts all matches that have a 0 in them. See example below for\n",
      " |      cautions.\n",
      " |      \n",
      " |      The list of possible combinations of queries and replacement values\n",
      " |      is listed below:\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      Initial setup\n",
      " |      \n",
      " |      >>> from sympy import log, sin, cos, tan, Wild, Mul, Add\n",
      " |      >>> from sympy.abc import x, y\n",
      " |      >>> f = log(sin(x)) + tan(sin(x**2))\n",
      " |      \n",
      " |      1.1. type -> type\n",
      " |          obj.replace(type, newtype)\n",
      " |      \n",
      " |          When object of type ``type`` is found, replace it with the\n",
      " |          result of passing its argument(s) to ``newtype``.\n",
      " |      \n",
      " |          >>> f.replace(sin, cos)\n",
      " |          log(cos(x)) + tan(cos(x**2))\n",
      " |          >>> sin(x).replace(sin, cos, map=True)\n",
      " |          (cos(x), {sin(x): cos(x)})\n",
      " |          >>> (x*y).replace(Mul, Add)\n",
      " |          x + y\n",
      " |      \n",
      " |      1.2. type -> func\n",
      " |          obj.replace(type, func)\n",
      " |      \n",
      " |          When object of type ``type`` is found, apply ``func`` to its\n",
      " |          argument(s). ``func`` must be written to handle the number\n",
      " |          of arguments of ``type``.\n",
      " |      \n",
      " |          >>> f.replace(sin, lambda arg: sin(2*arg))\n",
      " |          log(sin(2*x)) + tan(sin(2*x**2))\n",
      " |          >>> (x*y).replace(Mul, lambda *args: sin(2*Mul(*args)))\n",
      " |          sin(2*x*y)\n",
      " |      \n",
      " |      2.1. pattern -> expr\n",
      " |          obj.replace(pattern(wild), expr(wild))\n",
      " |      \n",
      " |          Replace subexpressions matching ``pattern`` with the expression\n",
      " |          written in terms of the Wild symbols in ``pattern``.\n",
      " |      \n",
      " |          >>> a, b = map(Wild, 'ab')\n",
      " |          >>> f.replace(sin(a), tan(a))\n",
      " |          log(tan(x)) + tan(tan(x**2))\n",
      " |          >>> f.replace(sin(a), tan(a/2))\n",
      " |          log(tan(x/2)) + tan(tan(x**2/2))\n",
      " |          >>> f.replace(sin(a), a)\n",
      " |          log(x) + tan(x**2)\n",
      " |          >>> (x*y).replace(a*x, a)\n",
      " |          y\n",
      " |      \n",
      " |          Matching is exact by default when more than one Wild symbol\n",
      " |          is used: matching fails unless the match gives non-zero\n",
      " |          values for all Wild symbols:\n",
      " |      \n",
      " |          >>> (2*x + y).replace(a*x + b, b - a)\n",
      " |          y - 2\n",
      " |          >>> (2*x).replace(a*x + b, b - a)\n",
      " |          2*x\n",
      " |      \n",
      " |          When set to False, the results may be non-intuitive:\n",
      " |      \n",
      " |          >>> (2*x).replace(a*x + b, b - a, exact=False)\n",
      " |          2/x\n",
      " |      \n",
      " |      2.2. pattern -> func\n",
      " |          obj.replace(pattern(wild), lambda wild: expr(wild))\n",
      " |      \n",
      " |          All behavior is the same as in 2.1 but now a function in terms of\n",
      " |          pattern variables is used rather than an expression:\n",
      " |      \n",
      " |          >>> f.replace(sin(a), lambda a: sin(2*a))\n",
      " |          log(sin(2*x)) + tan(sin(2*x**2))\n",
      " |      \n",
      " |      3.1. func -> func\n",
      " |          obj.replace(filter, func)\n",
      " |      \n",
      " |          Replace subexpression ``e`` with ``func(e)`` if ``filter(e)``\n",
      " |          is True.\n",
      " |      \n",
      " |          >>> g = 2*sin(x**3)\n",
      " |          >>> g.replace(lambda expr: expr.is_Number, lambda expr: expr**2)\n",
      " |          4*sin(x**9)\n",
      " |      \n",
      " |      The expression itself is also targeted by the query but is done in\n",
      " |      such a fashion that changes are not made twice.\n",
      " |      \n",
      " |          >>> e = x*(x*y + 1)\n",
      " |          >>> e.replace(lambda x: x.is_Mul, lambda x: 2*x)\n",
      " |          2*x*(2*x*y + 1)\n",
      " |      \n",
      " |      When matching a single symbol, `exact` will default to True, but\n",
      " |      this may or may not be the behavior that is desired:\n",
      " |      \n",
      " |      Here, we want `exact=False`:\n",
      " |      \n",
      " |      >>> from sympy import Function\n",
      " |      >>> f = Function('f')\n",
      " |      >>> e = f(1) + f(0)\n",
      " |      >>> q = f(a), lambda a: f(a + 1)\n",
      " |      >>> e.replace(*q, exact=False)\n",
      " |      f(1) + f(2)\n",
      " |      >>> e.replace(*q, exact=True)\n",
      " |      f(0) + f(2)\n",
      " |      \n",
      " |      But here, the nature of matching makes selecting\n",
      " |      the right setting tricky:\n",
      " |      \n",
      " |      >>> e = x**(1 + y)\n",
      " |      >>> (x**(1 + y)).replace(x**(1 + a), lambda a: x**-a, exact=False)\n",
      " |      x\n",
      " |      >>> (x**(1 + y)).replace(x**(1 + a), lambda a: x**-a, exact=True)\n",
      " |      x**(-x - y + 1)\n",
      " |      >>> (x**y).replace(x**(1 + a), lambda a: x**-a, exact=False)\n",
      " |      x\n",
      " |      >>> (x**y).replace(x**(1 + a), lambda a: x**-a, exact=True)\n",
      " |      x**(1 - y)\n",
      " |      \n",
      " |      It is probably better to use a different form of the query\n",
      " |      that describes the target expression more precisely:\n",
      " |      \n",
      " |      >>> (1 + x**(1 + y)).replace(\n",
      " |      ... lambda x: x.is_Pow and x.exp.is_Add and x.exp.args[0] == 1,\n",
      " |      ... lambda x: x.base**(1 - (x.exp - 1)))\n",
      " |      ...\n",
      " |      x**(1 - y) + 1\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      \n",
      " |      subs: substitution of subexpressions as defined by the objects\n",
      " |            themselves.\n",
      " |      xreplace: exact node replacement in expr tree; also capable of\n",
      " |                using matching rules\n",
      " |  \n",
      " |  rewrite(self, *args, deep=True, **hints)\n",
      " |      Rewrite *self* using a defined rule.\n",
      " |      \n",
      " |      Rewriting transforms an expression to another, which is mathematically\n",
      " |      equivalent but structurally different. For example you can rewrite\n",
      " |      trigonometric functions as complex exponentials or combinatorial\n",
      " |      functions as gamma function.\n",
      " |      \n",
      " |      This method takes a *pattern* and a *rule* as positional arguments.\n",
      " |      *pattern* is optional parameter which defines the types of expressions\n",
      " |      that will be transformed. If it is not passed, all possible expressions\n",
      " |      will be rewritten. *rule* defines how the expression will be rewritten.\n",
      " |      \n",
      " |      Parameters\n",
      " |      ==========\n",
      " |      \n",
      " |      args : *rule*, or *pattern* and *rule*.\n",
      " |          - *pattern* is a type or an iterable of types.\n",
      " |          - *rule* can be any object.\n",
      " |      \n",
      " |      deep : bool, optional.\n",
      " |          If ``True``, subexpressions are recursively transformed. Default is\n",
      " |          ``True``.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      If *pattern* is unspecified, all possible expressions are transformed.\n",
      " |      \n",
      " |      >>> from sympy import cos, sin, exp, I\n",
      " |      >>> from sympy.abc import x\n",
      " |      >>> expr = cos(x) + I*sin(x)\n",
      " |      >>> expr.rewrite(exp)\n",
      " |      exp(I*x)\n",
      " |      \n",
      " |      Pattern can be a type or an iterable of types.\n",
      " |      \n",
      " |      >>> expr.rewrite(sin, exp)\n",
      " |      exp(I*x)/2 + cos(x) - exp(-I*x)/2\n",
      " |      >>> expr.rewrite([cos,], exp)\n",
      " |      exp(I*x)/2 + I*sin(x) + exp(-I*x)/2\n",
      " |      >>> expr.rewrite([cos, sin], exp)\n",
      " |      exp(I*x)\n",
      " |      \n",
      " |      Rewriting behavior can be implemented by defining ``_eval_rewrite()``\n",
      " |      method.\n",
      " |      \n",
      " |      >>> from sympy import Expr, sqrt, pi\n",
      " |      >>> class MySin(Expr):\n",
      " |      ...     def _eval_rewrite(self, rule, args, **hints):\n",
      " |      ...         x, = args\n",
      " |      ...         if rule == cos:\n",
      " |      ...             return cos(pi/2 - x, evaluate=False)\n",
      " |      ...         if rule == sqrt:\n",
      " |      ...             return sqrt(1 - cos(x)**2)\n",
      " |      >>> MySin(MySin(x)).rewrite(cos)\n",
      " |      cos(-cos(-x + pi/2) + pi/2)\n",
      " |      >>> MySin(x).rewrite(sqrt)\n",
      " |      sqrt(1 - cos(x)**2)\n",
      " |      \n",
      " |      Defining ``_eval_rewrite_as_[...]()`` method is supported for backwards\n",
      " |      compatibility reason. This may be removed in the future and using it is\n",
      " |      discouraged.\n",
      " |      \n",
      " |      >>> class MySin(Expr):\n",
      " |      ...     def _eval_rewrite_as_cos(self, *args, **hints):\n",
      " |      ...         x, = args\n",
      " |      ...         return cos(pi/2 - x, evaluate=False)\n",
      " |      >>> MySin(x).rewrite(cos)\n",
      " |      cos(-x + pi/2)\n",
      " |  \n",
      " |  simplify(self, **kwargs)\n",
      " |      See the simplify function in sympy.simplify\n",
      " |  \n",
      " |  sort_key(self, order=None)\n",
      " |      Return a sort key.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import S, I\n",
      " |      \n",
      " |      >>> sorted([S(1)/2, I, -I], key=lambda x: x.sort_key())\n",
      " |      [1/2, -I, I]\n",
      " |      \n",
      " |      >>> S(\"[x, 1/x, 1/x**2, x**2, x**(1/2), x**(1/4), x**(3/2)]\")\n",
      " |      [x, 1/x, x**(-2), x**2, sqrt(x), x**(1/4), x**(3/2)]\n",
      " |      >>> sorted(_, key=lambda x: x.sort_key())\n",
      " |      [x**(-2), 1/x, x**(1/4), sqrt(x), x, x**(3/2), x**2]\n",
      " |  \n",
      " |  subs(self, *args, **kwargs)\n",
      " |      Substitutes old for new in an expression after sympifying args.\n",
      " |      \n",
      " |      `args` is either:\n",
      " |        - two arguments, e.g. foo.subs(old, new)\n",
      " |        - one iterable argument, e.g. foo.subs(iterable). The iterable may be\n",
      " |           o an iterable container with (old, new) pairs. In this case the\n",
      " |             replacements are processed in the order given with successive\n",
      " |             patterns possibly affecting replacements already made.\n",
      " |           o a dict or set whose key/value items correspond to old/new pairs.\n",
      " |             In this case the old/new pairs will be sorted by op count and in\n",
      " |             case of a tie, by number of args and the default_sort_key. The\n",
      " |             resulting sorted list is then processed as an iterable container\n",
      " |             (see previous).\n",
      " |      \n",
      " |      If the keyword ``simultaneous`` is True, the subexpressions will not be\n",
      " |      evaluated until all the substitutions have been made.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import pi, exp, limit, oo\n",
      " |      >>> from sympy.abc import x, y\n",
      " |      >>> (1 + x*y).subs(x, pi)\n",
      " |      pi*y + 1\n",
      " |      >>> (1 + x*y).subs({x:pi, y:2})\n",
      " |      1 + 2*pi\n",
      " |      >>> (1 + x*y).subs([(x, pi), (y, 2)])\n",
      " |      1 + 2*pi\n",
      " |      >>> reps = [(y, x**2), (x, 2)]\n",
      " |      >>> (x + y).subs(reps)\n",
      " |      6\n",
      " |      >>> (x + y).subs(reversed(reps))\n",
      " |      x**2 + 2\n",
      " |      \n",
      " |      >>> (x**2 + x**4).subs(x**2, y)\n",
      " |      y**2 + y\n",
      " |      \n",
      " |      To replace only the x**2 but not the x**4, use xreplace:\n",
      " |      \n",
      " |      >>> (x**2 + x**4).xreplace({x**2: y})\n",
      " |      x**4 + y\n",
      " |      \n",
      " |      To delay evaluation until all substitutions have been made,\n",
      " |      set the keyword ``simultaneous`` to True:\n",
      " |      \n",
      " |      >>> (x/y).subs([(x, 0), (y, 0)])\n",
      " |      0\n",
      " |      >>> (x/y).subs([(x, 0), (y, 0)], simultaneous=True)\n",
      " |      nan\n",
      " |      \n",
      " |      This has the added feature of not allowing subsequent substitutions\n",
      " |      to affect those already made:\n",
      " |      \n",
      " |      >>> ((x + y)/y).subs({x + y: y, y: x + y})\n",
      " |      1\n",
      " |      >>> ((x + y)/y).subs({x + y: y, y: x + y}, simultaneous=True)\n",
      " |      y/(x + y)\n",
      " |      \n",
      " |      In order to obtain a canonical result, unordered iterables are\n",
      " |      sorted by count_op length, number of arguments and by the\n",
      " |      default_sort_key to break any ties. All other iterables are left\n",
      " |      unsorted.\n",
      " |      \n",
      " |      >>> from sympy import sqrt, sin, cos\n",
      " |      >>> from sympy.abc import a, b, c, d, e\n",
      " |      \n",
      " |      >>> A = (sqrt(sin(2*x)), a)\n",
      " |      >>> B = (sin(2*x), b)\n",
      " |      >>> C = (cos(2*x), c)\n",
      " |      >>> D = (x, d)\n",
      " |      >>> E = (exp(x), e)\n",
      " |      \n",
      " |      >>> expr = sqrt(sin(2*x))*sin(exp(x)*x)*cos(2*x) + sin(2*x)\n",
      " |      \n",
      " |      >>> expr.subs(dict([A, B, C, D, E]))\n",
      " |      a*c*sin(d*e) + b\n",
      " |      \n",
      " |      The resulting expression represents a literal replacement of the\n",
      " |      old arguments with the new arguments. This may not reflect the\n",
      " |      limiting behavior of the expression:\n",
      " |      \n",
      " |      >>> (x**3 - 3*x).subs({x: oo})\n",
      " |      nan\n",
      " |      \n",
      " |      >>> limit(x**3 - 3*x, x, oo)\n",
      " |      oo\n",
      " |      \n",
      " |      If the substitution will be followed by numerical\n",
      " |      evaluation, it is better to pass the substitution to\n",
      " |      evalf as\n",
      " |      \n",
      " |      >>> (1/x).evalf(subs={x: 3.0}, n=21)\n",
      " |      0.333333333333333333333\n",
      " |      \n",
      " |      rather than\n",
      " |      \n",
      " |      >>> (1/x).subs({x: 3.0}).evalf(21)\n",
      " |      0.333333333333333314830\n",
      " |      \n",
      " |      as the former will ensure that the desired level of precision is\n",
      " |      obtained.\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      replace: replacement capable of doing wildcard-like matching,\n",
      " |               parsing of match, and conditional replacements\n",
      " |      xreplace: exact node replacement in expr tree; also capable of\n",
      " |                using matching rules\n",
      " |      sympy.core.evalf.EvalfMixin.evalf: calculates the given formula to a desired level of precision\n",
      " |  \n",
      " |  xreplace(self, rule)\n",
      " |      Replace occurrences of objects within the expression.\n",
      " |      \n",
      " |      Parameters\n",
      " |      ==========\n",
      " |      \n",
      " |      rule : dict-like\n",
      " |          Expresses a replacement rule\n",
      " |      \n",
      " |      Returns\n",
      " |      =======\n",
      " |      \n",
      " |      xreplace : the result of the replacement\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import symbols, pi, exp\n",
      " |      >>> x, y, z = symbols('x y z')\n",
      " |      >>> (1 + x*y).xreplace({x: pi})\n",
      " |      pi*y + 1\n",
      " |      >>> (1 + x*y).xreplace({x: pi, y: 2})\n",
      " |      1 + 2*pi\n",
      " |      \n",
      " |      Replacements occur only if an entire node in the expression tree is\n",
      " |      matched:\n",
      " |      \n",
      " |      >>> (x*y + z).xreplace({x*y: pi})\n",
      " |      z + pi\n",
      " |      >>> (x*y*z).xreplace({x*y: pi})\n",
      " |      x*y*z\n",
      " |      >>> (2*x).xreplace({2*x: y, x: z})\n",
      " |      y\n",
      " |      >>> (2*2*x).xreplace({2*x: y, x: z})\n",
      " |      4*z\n",
      " |      >>> (x + y + 2).xreplace({x + y: 2})\n",
      " |      x + y + 2\n",
      " |      >>> (x + 2 + exp(x + 2)).xreplace({x + 2: y})\n",
      " |      x + exp(y) + 2\n",
      " |      \n",
      " |      xreplace doesn't differentiate between free and bound symbols. In the\n",
      " |      following, subs(x, y) would not change x since it is a bound symbol,\n",
      " |      but xreplace does:\n",
      " |      \n",
      " |      >>> from sympy import Integral\n",
      " |      >>> Integral(x, (x, 1, 2*x)).xreplace({x: y})\n",
      " |      Integral(y, (y, 1, 2*y))\n",
      " |      \n",
      " |      Trying to replace x with an expression raises an error:\n",
      " |      \n",
      " |      >>> Integral(x, (x, 1, 2*x)).xreplace({x: 2*y}) # doctest: +SKIP\n",
      " |      ValueError: Invalid limits given: ((2*y, 1, 4*y),)\n",
      " |      \n",
      " |      See Also\n",
      " |      ========\n",
      " |      replace: replacement capable of doing wildcard-like matching,\n",
      " |               parsing of match, and conditional replacements\n",
      " |      subs: substitution of subexpressions as defined by the objects\n",
      " |            themselves.\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Class methods inherited from sympy.core.basic.Basic:\n",
      " |  \n",
      " |  class_key() from sympy.core.assumptions.ManagedProperties\n",
      " |      Nice order of classes.\n",
      " |  \n",
      " |  fromiter(args, **assumptions) from sympy.core.assumptions.ManagedProperties\n",
      " |      Create a new object from an iterable.\n",
      " |      \n",
      " |      This is a convenience function that allows one to create objects from\n",
      " |      any iterable, without having to convert to a list or tuple first.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Tuple\n",
      " |      >>> Tuple.fromiter(i for i in range(5))\n",
      " |      (0, 1, 2, 3, 4)\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Readonly properties inherited from sympy.core.basic.Basic:\n",
      " |  \n",
      " |  args\n",
      " |      Returns a tuple of arguments of 'self'.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import cot\n",
      " |      >>> from sympy.abc import x, y\n",
      " |      \n",
      " |      >>> cot(x).args\n",
      " |      (x,)\n",
      " |      \n",
      " |      >>> cot(x).args[0]\n",
      " |      x\n",
      " |      \n",
      " |      >>> (x*y).args\n",
      " |      (x, y)\n",
      " |      \n",
      " |      >>> (x*y).args[1]\n",
      " |      y\n",
      " |      \n",
      " |      Notes\n",
      " |      =====\n",
      " |      \n",
      " |      Never use self._args, always use self.args.\n",
      " |      Only use _args in __new__ when creating a new function.\n",
      " |      Don't override .args() from Basic (so that it's easy to\n",
      " |      change the interface in the future if needed).\n",
      " |  \n",
      " |  assumptions0\n",
      " |      Return object `type` assumptions.\n",
      " |      \n",
      " |      For example:\n",
      " |      \n",
      " |        Symbol('x', real=True)\n",
      " |        Symbol('x', integer=True)\n",
      " |      \n",
      " |      are different objects. In other words, besides Python type (Symbol in\n",
      " |      this case), the initial assumptions are also forming their typeinfo.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Symbol\n",
      " |      >>> from sympy.abc import x\n",
      " |      >>> x.assumptions0\n",
      " |      {'commutative': True}\n",
      " |      >>> x = Symbol(\"x\", positive=True)\n",
      " |      >>> x.assumptions0\n",
      " |      {'commutative': True, 'complex': True, 'extended_negative': False,\n",
      " |       'extended_nonnegative': True, 'extended_nonpositive': False,\n",
      " |       'extended_nonzero': True, 'extended_positive': True, 'extended_real':\n",
      " |       True, 'finite': True, 'hermitian': True, 'imaginary': False,\n",
      " |       'infinite': False, 'negative': False, 'nonnegative': True,\n",
      " |       'nonpositive': False, 'nonzero': True, 'positive': True, 'real':\n",
      " |       True, 'zero': False}\n",
      " |  \n",
      " |  canonical_variables\n",
      " |      Return a dictionary mapping any variable defined in\n",
      " |      ``self.bound_symbols`` to Symbols that do not clash\n",
      " |      with any free symbols in the expression.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import Lambda\n",
      " |      >>> from sympy.abc import x\n",
      " |      >>> Lambda(x, 2*x).canonical_variables\n",
      " |      {x: _0}\n",
      " |  \n",
      " |  expr_free_symbols\n",
      " |  \n",
      " |  free_symbols\n",
      " |      Return from the atoms of self those which are free symbols.\n",
      " |      \n",
      " |      For most expressions, all symbols are free symbols. For some classes\n",
      " |      this is not true. e.g. Integrals use Symbols for the dummy variables\n",
      " |      which are bound variables, so Integral has a method to return all\n",
      " |      symbols except those. Derivative keeps track of symbols with respect\n",
      " |      to which it will perform a derivative; those are\n",
      " |      bound variables, too, so it has its own free_symbols method.\n",
      " |      \n",
      " |      Any other method that uses bound variables should implement a\n",
      " |      free_symbols method.\n",
      " |  \n",
      " |  func\n",
      " |      The top-level function in an expression.\n",
      " |      \n",
      " |      The following should hold for all objects::\n",
      " |      \n",
      " |          >> x == x.func(*x.args)\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy.abc import x\n",
      " |      >>> a = 2*x\n",
      " |      >>> a.func\n",
      " |      <class 'sympy.core.mul.Mul'>\n",
      " |      >>> a.args\n",
      " |      (2, x)\n",
      " |      >>> a.func(*a.args)\n",
      " |      2*x\n",
      " |      >>> a == a.func(*a.args)\n",
      " |      True\n",
      " |  \n",
      " |  is_algebraic\n",
      " |  \n",
      " |  is_antihermitian\n",
      " |  \n",
      " |  is_commutative\n",
      " |  \n",
      " |  is_comparable\n",
      " |      Return True if self can be computed to a real number\n",
      " |      (or already is a real number) with precision, else False.\n",
      " |      \n",
      " |      Examples\n",
      " |      ========\n",
      " |      \n",
      " |      >>> from sympy import exp_polar, pi, I\n",
      " |      >>> (I*exp_polar(I*pi/2)).is_comparable\n",
      " |      True\n",
      " |      >>> (I*exp_polar(I*pi*2)).is_comparable\n",
      " |      False\n",
      " |      \n",
      " |      A False result does not mean that `self` cannot be rewritten\n",
      " |      into a form that would be comparable. For example, the\n",
      " |      difference computed below is zero but without simplification\n",
      " |      it does not evaluate to a zero with precision:\n",
      " |      \n",
      " |      >>> e = 2**pi*(1 + 2**pi)\n",
      " |      >>> dif = e - e.expand()\n",
      " |      >>> dif.is_comparable\n",
      " |      False\n",
      " |      >>> dif.n(2)._prec\n",
      " |      1\n",
      " |  \n",
      " |  is_complex\n",
      " |  \n",
      " |  is_composite\n",
      " |  \n",
      " |  is_even\n",
      " |  \n",
      " |  is_extended_negative\n",
      " |  \n",
      " |  is_extended_nonnegative\n",
      " |  \n",
      " |  is_extended_nonpositive\n",
      " |  \n",
      " |  is_extended_nonzero\n",
      " |  \n",
      " |  is_extended_positive\n",
      " |  \n",
      " |  is_extended_real\n",
      " |  \n",
      " |  is_finite\n",
      " |  \n",
      " |  is_hermitian\n",
      " |  \n",
      " |  is_imaginary\n",
      " |  \n",
      " |  is_infinite\n",
      " |  \n",
      " |  is_integer\n",
      " |  \n",
      " |  is_irrational\n",
      " |  \n",
      " |  is_negative\n",
      " |  \n",
      " |  is_noninteger\n",
      " |  \n",
      " |  is_nonnegative\n",
      " |  \n",
      " |  is_nonpositive\n",
      " |  \n",
      " |  is_nonzero\n",
      " |  \n",
      " |  is_odd\n",
      " |  \n",
      " |  is_polar\n",
      " |  \n",
      " |  is_positive\n",
      " |  \n",
      " |  is_prime\n",
      " |  \n",
      " |  is_rational\n",
      " |  \n",
      " |  is_real\n",
      " |  \n",
      " |  is_transcendental\n",
      " |  \n",
      " |  is_zero\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Data and other attributes inherited from sympy.core.basic.Basic:\n",
      " |  \n",
      " |  is_Add = False\n",
      " |  \n",
      " |  is_AlgebraicNumber = False\n",
      " |  \n",
      " |  is_Atom = False\n",
      " |  \n",
      " |  is_Boolean = False\n",
      " |  \n",
      " |  is_Derivative = False\n",
      " |  \n",
      " |  is_Dummy = False\n",
      " |  \n",
      " |  is_Equality = False\n",
      " |  \n",
      " |  is_Float = False\n",
      " |  \n",
      " |  is_Function = False\n",
      " |  \n",
      " |  is_Indexed = False\n",
      " |  \n",
      " |  is_Integer = False\n",
      " |  \n",
      " |  is_MatAdd = False\n",
      " |  \n",
      " |  is_MatMul = False\n",
      " |  \n",
      " |  is_Matrix = False\n",
      " |  \n",
      " |  is_Mul = False\n",
      " |  \n",
      " |  is_Not = False\n",
      " |  \n",
      " |  is_Number = False\n",
      " |  \n",
      " |  is_NumberSymbol = False\n",
      " |  \n",
      " |  is_Order = False\n",
      " |  \n",
      " |  is_Piecewise = False\n",
      " |  \n",
      " |  is_Point = False\n",
      " |  \n",
      " |  is_Poly = False\n",
      " |  \n",
      " |  is_Pow = False\n",
      " |  \n",
      " |  is_Rational = False\n",
      " |  \n",
      " |  is_Relational = False\n",
      " |  \n",
      " |  is_Symbol = False\n",
      " |  \n",
      " |  is_Vector = False\n",
      " |  \n",
      " |  is_Wild = False\n",
      " |  \n",
      " |  is_symbol = False\n",
      " |  \n",
      " |  kind = UndefinedKind\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Methods inherited from sympy.printing.defaults.Printable:\n",
      " |  \n",
      " |  __repr__ = __str__(self)\n",
      " |  \n",
      " |  __str__(self)\n",
      " |      Return str(self).\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Methods inherited from sympy.core.evalf.EvalfMixin:\n",
      " |  \n",
      " |  evalf(self, n=15, subs=None, maxn=100, chop=False, strict=False, quad=None, verbose=False)\n",
      " |      Evaluate the given formula to an accuracy of *n* digits.\n",
      " |      \n",
      " |      Parameters\n",
      " |      ==========\n",
      " |      \n",
      " |      subs : dict, optional\n",
      " |          Substitute numerical values for symbols, e.g.\n",
      " |          ``subs={x:3, y:1+pi}``. The substitutions must be given as a\n",
      " |          dictionary.\n",
      " |      \n",
      " |      maxn : int, optional\n",
      " |          Allow a maximum temporary working precision of maxn digits.\n",
      " |      \n",
      " |      chop : bool or number, optional\n",
      " |          Specifies how to replace tiny real or imaginary parts in\n",
      " |          subresults by exact zeros.\n",
      " |      \n",
      " |          When ``True`` the chop value defaults to standard precision.\n",
      " |      \n",
      " |          Otherwise the chop value is used to determine the\n",
      " |          magnitude of \"small\" for purposes of chopping.\n",
      " |      \n",
      " |          >>> from sympy import N\n",
      " |          >>> x = 1e-4\n",
      " |          >>> N(x, chop=True)\n",
      " |          0.000100000000000000\n",
      " |          >>> N(x, chop=1e-5)\n",
      " |          0.000100000000000000\n",
      " |          >>> N(x, chop=1e-4)\n",
      " |          0\n",
      " |      \n",
      " |      strict : bool, optional\n",
      " |          Raise ``PrecisionExhausted`` if any subresult fails to\n",
      " |          evaluate to full accuracy, given the available maxprec.\n",
      " |      \n",
      " |      quad : str, optional\n",
      " |          Choose algorithm for numerical quadrature. By default,\n",
      " |          tanh-sinh quadrature is used. For oscillatory\n",
      " |          integrals on an infinite interval, try ``quad='osc'``.\n",
      " |      \n",
      " |      verbose : bool, optional\n",
      " |          Print debug information.\n",
      " |      \n",
      " |      Notes\n",
      " |      =====\n",
      " |      \n",
      " |      When Floats are naively substituted into an expression,\n",
      " |      precision errors may adversely affect the result. For example,\n",
      " |      adding 1e16 (a Float) to 1 will truncate to 1e16; if 1e16 is\n",
      " |      then subtracted, the result will be 0.\n",
      " |      That is exactly what happens in the following:\n",
      " |      \n",
      " |      >>> from sympy.abc import x, y, z\n",
      " |      >>> values = {x: 1e16, y: 1, z: 1e16}\n",
      " |      >>> (x + y - z).subs(values)\n",
      " |      0\n",
      " |      \n",
      " |      Using the subs argument for evalf is the accurate way to\n",
      " |      evaluate such an expression:\n",
      " |      \n",
      " |      >>> (x + y - z).evalf(subs=values)\n",
      " |      1.00000000000000\n",
      " |  \n",
      " |  n = evalf(self, n=15, subs=None, maxn=100, chop=False, strict=False, quad=None, verbose=False)\n",
      "\n"
     ]
    }
   ],
   "source": [
    "help(FiniteSet)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "id": "587669b7",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle 0 < x \\wedge x < 5$"
      ],
      "text/plain": [
       "(0 < x) & (x < 5)"
      ]
     },
     "execution_count": 50,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "solveset(x**2-5*x<0,x,Reals).as_relational(x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "id": "463c65b7",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left(-\\infty < x \\wedge x < -1\\right) \\vee \\left(3 < x \\wedge x < \\infty\\right)$"
      ],
      "text/plain": [
       "((-oo < x) & (x < -1)) | ((3 < x) & (x < oo))"
      ]
     },
     "execution_count": 52,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "solveset(x**2-2*x-3>0,x,Reals).as_relational(x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "id": "2c7ab593",
   "metadata": {},
   "outputs": [],
   "source": [
    "a,c=symbols(\"a,c\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "id": "332b8c97",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(a, c)"
      ]
     },
     "execution_count": 57,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a,c"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 66,
   "id": "4a3adbc4",
   "metadata": {},
   "outputs": [],
   "source": [
    "def function_max(f,x,interval=Reals,with_x=False):\n",
    "    '''\n",
    "        If you use the triangle function, it may have errors \n",
    "        for can't judge the solve is in Reals.\n",
    "        You can use trigsimp to simplify the expression of x.\n",
    "        It may solve the problem.\n",
    "    '''\n",
    "    # fix the problem of function solve.\n",
    "    if interval==Reals:\n",
    "        x_list=solve(diff(f,x),x)\n",
    "    else:\n",
    "        x_sets=solveset(diff(f,x),x,interval)\n",
    "        x_list=[]\n",
    "        for item in x_sets:\n",
    "            x_list.append(item)\n",
    "            \n",
    "    check_function=diff(f,x,x)\n",
    "\n",
    "    x_list_length=len(x_list)\n",
    "    if with_x==True:\n",
    "        answer={}\n",
    "        for i in range(x_list_length):\n",
    "            # If the x is not in Reals it has no meaning.\n",
    "            if not(x_list[i] in Reals):\n",
    "                continue\n",
    "            if (check_function.subs(x,x_list[i]))<0:\n",
    "                answer[x_list[i]]=(f.subs(x,x_list[i]))\n",
    "    else:\n",
    "        answer=[]\n",
    "        for i in range(x_list_length):\n",
    "            # If the x is not in Reals it has no meaning.\n",
    "            if not(x_list[i] in Reals):\n",
    "                continue\n",
    "            if (check_function.subs(x,x_list[i]))<0:\n",
    "                answer.append(f.subs(x,x_list[i]))\n",
    "    return answer\n",
    "            "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 59,
   "id": "7eb050db",
   "metadata": {},
   "outputs": [],
   "source": [
    "calc_quadratic=-Rational(1,12)*x**2+Rational(4,3)*x+Rational(4,3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 123,
   "id": "65894a82",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle - \\frac{x^{2}}{12} + \\frac{4 x}{3} + \\frac{4}{3}$"
      ],
      "text/plain": [
       "-x**2/12 + 4*x/3 + 4/3"
      ]
     },
     "execution_count": 123,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "cancel(calc_quadratic)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 67,
   "id": "a4ba285f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{8: 20/3}"
      ]
     },
     "execution_count": 67,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "function_max(calc_quadratic,x,Reals,True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "id": "acc1b678",
   "metadata": {},
   "outputs": [],
   "source": [
    "from function_calculator_package.extreme_points import *"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 64,
   "id": "794a5bf6",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[20/3]"
      ]
     },
     "execution_count": 64,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "function_max(calc_quadratic,x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 58,
   "id": "52bd5cb0",
   "metadata": {},
   "outputs": [],
   "source": [
    "expr=a*x**2+Rational(3,2)*x+c"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 74,
   "id": "08c20593",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left[- \\frac{3}{32}, \\infty\\right)$"
      ],
      "text/plain": [
       "Interval(-3/32, oo)"
      ]
     },
     "execution_count": 74,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "solveset(expr.subs([(x,8),(c,4)])>=Rational(30,3),a,Reals)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 126,
   "id": "7dacd3b1",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle - \\frac{x^{2}}{2} + \\frac{3 x}{2} + 2$"
      ],
      "text/plain": [
       "-x**2/2 + 3*x/2 + 2"
      ]
     },
     "execution_count": 126,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "expand(-Rational(1,2)*(x+1)*(x-4))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 76,
   "id": "ec5bfe08",
   "metadata": {},
   "outputs": [],
   "source": [
    "expr=2*(x-4)**2+6"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 77,
   "id": "876756cb",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{}"
      ]
     },
     "execution_count": 77,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "function_max(expr,x,Reals,True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 78,
   "id": "af0e8917",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{4: 6}"
      ]
     },
     "execution_count": 78,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "function_min(expr,x,Reals,True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 80,
   "id": "6f1ad108",
   "metadata": {},
   "outputs": [],
   "source": [
    "from sympy.abc import b"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 115,
   "id": "820aa6e5",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle 2 b^{2} - 2 b x - 4 c + x^{2}$"
      ],
      "text/plain": [
       "2*b**2 - 2*b*x - 4*c + x**2"
      ]
     },
     "execution_count": 115,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "expr=x**2-2*b*x+2*b**2-4*c\n",
    "expr"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 116,
   "id": "f648331f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle 2 b^{2} - 2 b x - 4 c + x^{2} = y$"
      ],
      "text/plain": [
       "Eq(2*b**2 - 2*b*x - 4*c + x**2, y)"
      ]
     },
     "execution_count": 116,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "eq=Eq(expr,y)\n",
    "eq"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 117,
   "id": "cf835617",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle 2 b^{2} - 2 b \\left(1 - b\\right) - 4 c + \\left(1 - b\\right)^{2} = 2 b^{2} - 2 b \\left(2 b + c\\right) - 4 c + \\left(2 b + c\\right)^{2}$"
      ],
      "text/plain": [
       "Eq(2*b**2 - 2*b*(1 - b) - 4*c + (1 - b)**2, 2*b**2 - 2*b*(2*b + c) - 4*c + (2*b + c)**2)"
      ]
     },
     "execution_count": 117,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "eq1=Eq(expr.subs(x,1-b),expr.subs(x,2*b+c))\n",
    "eq1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 118,
   "id": "d146b74d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[(1/3 - c/3, c), (c + 1, c)]"
      ]
     },
     "execution_count": 118,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "solve(eq1,[b,c])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 119,
   "id": "fddb6df4",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\text{True}$"
      ],
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 119,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "simplify(eq1.subs(b,(1-c)/3))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 108,
   "id": "146294eb",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\frac{5 c^{2}}{9} - \\frac{34 c}{9} + \\frac{2}{9}$"
      ],
      "text/plain": [
       "5*c**2/9 - 34*c/9 + 2/9"
      ]
     },
     "execution_count": 108,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "simplify(eq1.lhs.subs(b,(1-c)/3))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 120,
   "id": "0e55b7c4",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle - 4 b^{2} + 16 c$"
      ],
      "text/plain": [
       "-4*b**2 + 16*c"
      ]
     },
     "execution_count": 120,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "restrain=quadratic_equation_delt(Eq(expr,0),x)\n",
    "restrain"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 129,
   "id": "c9367fe1",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle - 4 \\left(c - 1\\right)^{2}$"
      ],
      "text/plain": [
       "-4*(c - 1)**2"
      ]
     },
     "execution_count": 129,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "factor(restrain.subs(b,c+1))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 96,
   "id": "8502259c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left(300 - 10 x\\right) \\left(x + 10\\right)$"
      ],
      "text/plain": [
       "(300 - 10*x)*(x + 10)"
      ]
     },
     "execution_count": 96,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "profit=(300-10*x)*(10+x)\n",
    "profit"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 98,
   "id": "b973016a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left[2, 18\\right]$"
      ],
      "text/plain": [
       "Interval(2, 18)"
      ]
     },
     "execution_count": 98,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "solveset(profit>=3360,x,Reals)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 99,
   "id": "78fb2052",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{10: 4000}"
      ]
     },
     "execution_count": 99,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "function_max(profit,x,Reals,True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 101,
   "id": "f0ce659d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle y = a x^{2} + 3.5$"
      ],
      "text/plain": [
       "Eq(y, a*x**2 + 3.5)"
      ]
     },
     "execution_count": 101,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "eq2=Eq(y,a*x**2+3.5)\n",
    "eq2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 103,
   "id": "e533faa0",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left\\{-0.2\\right\\}$"
      ],
      "text/plain": [
       "{-0.2}"
      ]
     },
     "execution_count": 103,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "solveset(eq2.subs([(x,1.5),(y,3.05)]),a)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 104,
   "id": "9006d73a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle y = 3.5 - 0.2 x^{2}$"
      ],
      "text/plain": [
       "Eq(y, 3.5 - 0.2*x**2)"
      ]
     },
     "execution_count": 104,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "eq2_end=eq2.subs(a,-0.2)\n",
    "eq2_end"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 106,
   "id": "81bb7605",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle 0.2$"
      ],
      "text/plain": [
       "0.200000000000000"
      ]
     },
     "execution_count": 106,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "(eq2_end.rhs).subs(x,-2.5)-(1.8+0.25)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "cdc14438",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "id": "24b434c3",
   "metadata": {},
   "source": [
    "## 数学八"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 130,
   "id": "cff0dd45",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle - 5 m^{2} - 2 m x + x^{2} - 3 = 0$"
      ],
      "text/plain": [
       "Eq(-5*m**2 - 2*m*x + x**2 - 3, 0)"
      ]
     },
     "execution_count": 130,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "eq2=Eq(x**2-2*m*x-5*m**2-3,0)\n",
    "eq2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 131,
   "id": "c0e027be",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left\\{-2, 4\\right\\}$"
      ],
      "text/plain": [
       "{-2, 4}"
      ]
     },
     "execution_count": 131,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "solveset(eq2.subs(m,1),x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 132,
   "id": "dcea7806",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle 24 m^{2} + 12$"
      ],
      "text/plain": [
       "24*m**2 + 12"
      ]
     },
     "execution_count": 132,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "quadratic_equation_delt(eq2,x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 133,
   "id": "a05bcaf0",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "24.0"
      ]
     },
     "execution_count": 133,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "3/0.125"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 134,
   "id": "f1acf295",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "9.0"
      ]
     },
     "execution_count": 134,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "24*0.375"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 135,
   "id": "502d5f46",
   "metadata": {},
   "outputs": [],
   "source": [
    "r=symbols(\"r\",positive=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 137,
   "id": "3c4eb212",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left\\{-3, 5\\right\\}$"
      ],
      "text/plain": [
       "{-3, 5}"
      ]
     },
     "execution_count": 137,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "solveset(Eq(2*sqrt(r**2-3**2),r+3),r,Reals)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 145,
   "id": "d14ed18e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle y = 2 m + 2 \\left(- m + x\\right)^{2}$"
      ],
      "text/plain": [
       "Eq(y, 2*m + 2*(-m + x)**2)"
      ]
     },
     "execution_count": 145,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "eq3=Eq(y,2*(x-m)**2+2*m)\n",
    "eq3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 140,
   "id": "f12af25e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{1/2: 1}"
      ]
     },
     "execution_count": 140,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "function_min(eq3.rhs.subs(m,Rational(1,2)),x,Reals,True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 142,
   "id": "aa7d20c6",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\frac{3}{2}$"
      ],
      "text/plain": [
       "3/2"
      ]
     },
     "execution_count": 142,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "eq3.rhs.subs(m,Rational(1,2)).subs(x,0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 165,
   "id": "84ae45ce",
   "metadata": {},
   "outputs": [],
   "source": [
    "def function_min(f,x,interval=Reals,with_x=False):\n",
    "    '''\n",
    "     If you use the triangle function, it may have errors \n",
    "        for can't judge the solve is in Reals.\n",
    "        You can use trigsimp to simplify the expression of x.\n",
    "        It may solve the problem.\n",
    "    '''\n",
    "    # fix the problem of function solve.\n",
    "    x_sets=solveset(diff(f,x),x,interval)\n",
    "    x_list=[]\n",
    "    for item in x_sets:\n",
    "        x_list.append(item)\n",
    "            \n",
    "    check_function=diff(f,x,x)\n",
    "\n",
    "    x_list_length=len(x_list)\n",
    "    if with_x==True:\n",
    "        answer={}\n",
    "        for i in range(x_list_length):\n",
    "            if (check_function.subs(x,x_list[i]))>0:\n",
    "                answer[x_list[i]]=(f.subs(x,x_list[i]))\n",
    "    else:\n",
    "        answer=[]\n",
    "        for i in range(x_list_length):\n",
    "            if (check_function.subs(x,x_list[i]))>0:\n",
    "                answer.append(f.subs(x,x_list[i]))\n",
    "    \n",
    "    return answer"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 169,
   "id": "b421192f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\mathbb{R} \\cap \\left\\{m\\right\\}$"
      ],
      "text/plain": [
       "Intersection({m}, Reals)"
      ]
     },
     "execution_count": 169,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "solveset(diff(eq3.rhs,x),x,Reals)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 170,
   "id": "519e1b2e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle y = 2 \\left(x - 1\\right)^{2} + 2$"
      ],
      "text/plain": [
       "Eq(y, 2*(x - 1)**2 + 2)"
      ]
     },
     "execution_count": 170,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "eq3.subs(m,1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 174,
   "id": "b72a8c2b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAagAAAEXCAYAAAD4LtBgAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAAsTAAALEwEAmpwYAAAzk0lEQVR4nO3deVxVdf7H8ddhX2QR2RcFBZHNSK+4pJajqFnpqJNpVpqmpTVN60zT/Cq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aEuZItKCGEELokn0EJIYTQJSkoIYQQuiQFJYQQQpekoIQQQuiSFJQQQghdkoISQgihS1JQQgghdOn/Abp3ui6zz6uIAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "<sympy.plotting.plot.Plot at 0x7f28d121c100>"
      ]
     },
     "execution_count": 174,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "plot(eq3.subs(m,1).rhs)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 175,
   "id": "c1b5a66d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left\\{- \\frac{1}{2} + \\frac{\\sqrt{7}}{2}, - \\frac{\\sqrt{7}}{2} - \\frac{1}{2}\\right\\}$"
      ],
      "text/plain": [
       "{-1/2 + sqrt(7)/2, -sqrt(7)/2 - 1/2}"
      ]
     },
     "execution_count": 175,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "solveset(eq3.rhs.subs(x,2*m)-3,m,Reals)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "7e2c4edc",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.13"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
